package com.example.vv.task;

import cn.hutool.core.date.DateUtil;
import java.util.concurrent.TimeUnit;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author w.dehai.2024/7/31.09:19
 */
//@Component
public class CleanTask {

    @Async
    @Scheduled(cron = "*/2 * * * * ?")
    public void mm() throws Exception {
        System.err.println("mm: " + DateUtil.date() + ", threadName: "
                + Thread.currentThread().getName());
        TimeUnit.SECONDS.sleep(4L);
    }

    @Async
    @Scheduled(cron = "*/3 * * * * ?")
    public void nn() throws Exception {
        System.err.println("                                                                nn: " + DateUtil.date()
                + ", threadName: " + Thread.currentThread().getName());
        TimeUnit.SECONDS.sleep(5L);
    }

    @Async
    @Scheduled(cron = "* */5 * * * ?")
    public void qq() throws Exception {
        System.err.println("5分钟");
        TimeUnit.SECONDS.sleep(5L);
    }
}
